package reflect;

import java.lang.reflect.Member;
import java.lang.reflect.Method;

public class ReflectDemo5 {
    public static void main(String[] args) throws Exception {
        Person p=new Person();
        p.say("你好");

        Class cls=Class.forName("reflect.Person");
        Object obj=cls.newInstance();
        //asy(String info)
        Method member =cls.getMethod("say",String.class);
        member.invoke(obj,"哈哈");

        Method method2=cls.getMethod("say", String.class,int.class);
        method2.invoke(obj,"你好",3);
    }
}
